//
//  TimEmptyView.swift
//  TimMusic
//
//  Created by nkl on 2024/10/25.
//

import Foundation

class TimEmptyView : UIView {
    lazy var iconView : UIImageView = .simpleImage(imageName: "ic_empty_data")
    lazy var titleLabel : UILabel = .simpleLabel(text: "No Music, Please Add",font: .systemFont18,color: .white)
    lazy var importButton : UIButton =  {
        let btn = UIButton()
        btn.setTitle("Add", for: .normal)
        btn.backgroundColor = .white
        btn.setTitleColor(UIColor.black, for: .normal)
        btn.layer.cornerRadius = 16
        btn.layer.masksToBounds = true
        
        return btn
    }()
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        addChildren()
        makeConstraints()
    }
    
  
    
    func addChildren(){
        addSubview(iconView)
        addSubview(titleLabel)
        addSubview(importButton)
    }
    
    func makeConstraints(){
        iconView.snp.makeConstraints { make in
            make.centerY.equalToSuperview().offset(-50)
            make.centerX.equalToSuperview()
            make.width.height.equalTo(144)
        }
        
        titleLabel.snp.makeConstraints { make in
            make.top.equalTo(iconView.snp.bottom).offset(16)
            make.centerX.equalToSuperview()
        }
        
        importButton.snp.makeConstraints { make in
            make.centerX.equalToSuperview()
            make.top.equalTo(titleLabel.snp.bottom).offset(20)
            make.width.equalTo(80)
            make.height.equalTo(30)
        }
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
